#include <ShObjIdl.h>
#include "IShellBrowserImpl.h"


IShellBrowserImpl::~IShellBrowserImpl()
{
}
STDMETHODIMP IShellBrowserImpl::QueryInterface(REFIID iid, void **ppvObject)
{
	if (ppvObject == NULL)
		return E_POINTER;

	*ppvObject = NULL;

	if (iid == IID_IUnknown)
		*ppvObject = (IUnknown*)(IShellBrowser*) this;
	else if (iid == IID_IOleWindow)
		*ppvObject = (IOleWindow*) this;
	else if (iid == IID_IShellBrowser)
		*ppvObject = (IShellBrowser*) this;
	else if (iid == IID_ICommDlgBrowser)
		*ppvObject = (ICommDlgBrowser*) this;
	else if (IsEqualIID(iid, IID_IServiceProvider))
		*ppvObject = static_cast<IServiceProvider*>(this);
	else if (iid == IID_IOleCommandTarget)
		*ppvObject = static_cast<IOleCommandTarget*>(this);
	else if (iid == IID_ICommDlgBrowser2)
	{
		OutputDebugString(L"IShellBrowserImpl::QueryInterface IID_ICommDlgBrowser2\n");
		return E_NOINTERFACE;
	}
	else if (iid == IID_ICommDlgBrowser3)
	{
		*ppvObject = static_cast<ICommDlgBrowser3*>(this);
	}
	else
		return E_NOINTERFACE;
	((IUnknown*)(*ppvObject))->AddRef();
	return S_OK;
}
// IServiceProvider methods  
STDMETHODIMP IShellBrowserImpl::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
{
	OutputDebugString(L"IShellBrowserImpl::QueryService\n");
	if (ppvObject == NULL)
		return E_POINTER;

	if (IsEqualGUID(riid, IID_IShellBrowser))
		return QueryInterface(riid, ppvObject);
	else if (IsEqualGUID(riid, IID_INameSpaceTreeControl))
	{
		//return QueryInterface(riid, ppvObject);
	}
	return E_NOINTERFACE;
}
// IOleWindow methods  
STDMETHODIMP IShellBrowserImpl::GetWindow(HWND *phwnd)
{
	OutputDebugString(L"IShellBrowserImpl::GetWindow\n");
	return E_NOTIMPL;
}

STDMETHODIMP IShellBrowserImpl::ContextSensitiveHelp(BOOL fEnterMode)
{
	OutputDebugString(L"IShellBrowserImpl::ContextSensitiveHelp\n");
	return E_NOTIMPL;
}
// *** ICommDlgBrowser methods ***
STDMETHODIMP IShellBrowserImpl::OnDefaultCommand(THIS_ struct IShellView * ppshv)
{	//handle double click and ENTER key if needed
	OutputDebugString(L"IShellBrowserImpl::OnDefaultCommand\n");
	return E_NOTIMPL;
}
STDMETHODIMP IShellBrowserImpl::OnStateChange(THIS_ struct IShellView * ppshv, ULONG uChange)
{	//handle selection, rename, focus if needed
	OutputDebugString(L"IShellBrowserImpl::OnStateChange\n");
	return E_NOTIMPL;
}
STDMETHODIMP IShellBrowserImpl::IncludeObject(THIS_ struct IShellView * ppshv, LPCITEMIDLIST pidl)
{	//filter files if needed
	OutputDebugString(L"IShellBrowserImpl::IncludeObject\n");
	return S_OK;
}
// IShellBrowser methods  
STDMETHODIMP IShellBrowserImpl::BrowseObject(PCUIDLIST_RELATIVE pidl, UINT wFlags)
{
	OutputDebugString(L"IShellBrowserImpl::BrowseObject\n");
	return E_NOTIMPL;
}

STDMETHODIMP IShellBrowserImpl::EnableModelessSB(BOOL fEnable)
{
	OutputDebugString(L"IShellBrowserImpl::EnableModelessSB\n");
	return E_NOTIMPL;
}

STDMETHODIMP IShellBrowserImpl::GetControlWindow(UINT id, HWND *lphwnd)
{
	OutputDebugString(L"IShellBrowserImpl::GetControlWindow\n"); 
	return E_NOTIMPL;
}

STDMETHODIMP IShellBrowserImpl::GetViewStateStream(DWORD grfMode, IStream **ppStrm)
{
	OutputDebugString(L"IShellBrowserImpl::GetViewStateStream\n");
	return E_NOTIMPL;
}

STDMETHODIMP IShellBrowserImpl::InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
{
	OutputDebugString(L"IShellBrowserImpl::InsertMenusSB\n");
	return E_NOTIMPL;
}

STDMETHODIMP IShellBrowserImpl::OnViewWindowActive(IShellView *ppshv)
{
	OutputDebugString(L"IShellBrowserImpl::OnViewWindowActive\n");
	return E_NOTIMPL;
}

STDMETHODIMP IShellBrowserImpl::QueryActiveShellView(IShellView **ppshv)
{
	OutputDebugString(L"IShellBrowserImpl::QueryActiveShellView\n");
	return E_NOTIMPL;
}

STDMETHODIMP IShellBrowserImpl::RemoveMenusSB(HMENU hmenuShared)
{
	OutputDebugString(L"IShellBrowserImpl::RemoveMenusSB\n");
	return E_NOTIMPL;
}

STDMETHODIMP IShellBrowserImpl::SendControlMsg(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret)
{
	OutputDebugString(L"IShellBrowserImpl::SendControlMsg\n");
	return E_NOTIMPL;
}

STDMETHODIMP IShellBrowserImpl::SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject)
{
	OutputDebugString(L"IShellBrowserImpl::SetMenuSB\n");
	return E_NOTIMPL;
}

STDMETHODIMP IShellBrowserImpl::SetStatusTextSB(LPCWSTR lpszStatusText)
{
	OutputDebugString(L"IShellBrowserImpl::SetStatusTextSB\n");
	return E_NOTIMPL;
}

STDMETHODIMP IShellBrowserImpl::SetToolbarItems(LPTBBUTTONSB lpButtons, UINT nButtons, UINT uFlags)
{
	OutputDebugString(L"IShellBrowserImpl::SetToolbarItems\n");
	return E_NOTIMPL;
}

STDMETHODIMP IShellBrowserImpl::TranslateAcceleratorSB(LPMSG lpmsg, WORD wID)
{
	OutputDebugString(L"IShellBrowserImpl::TranslateAcceleratorSB\n");
	return S_OK;
}
// *** ICommDlgBrowser2 methods ***
STDMETHODIMP IShellBrowserImpl::Notify(
	/* [in] */ __RPC__in_opt IShellView *ppshv,
	/* [in] */ DWORD dwNotifyType)
{
	OutputDebugString(L"IShellBrowserImpl::Notify\n");
	return E_NOTIMPL;
}

STDMETHODIMP IShellBrowserImpl::GetDefaultMenuText(
	/* [in] */ __RPC__in_opt IShellView *ppshv,
	/* [size_is][string][out] */ __RPC__out_ecount_full_string(cchMax) LPWSTR pszText,
	/* [in] */ int cchMax)
{
	OutputDebugString(L"IShellBrowserImpl::GetDefaultMenuText\n");
	return E_NOTIMPL;
}

STDMETHODIMP IShellBrowserImpl::GetViewFlags(
	/* [out] */ __RPC__out DWORD *pdwFlags)
{
	OutputDebugString(L"IShellBrowserImpl::GetViewFlags\n");
	*pdwFlags = CDB2GVF_SHOWALLFILES | CDB2GVF_NOSELECTVERB | CDB2GVF_NOINCLUDEITEM;
	return S_OK;
	return E_NOTIMPL;
}
// *** ICommDlgBrowser3 methods ***
STDMETHODIMP IShellBrowserImpl::OnColumnClicked(__RPC__in_opt IShellView *ppshv, int iColumn)
{
	OutputDebugString(L"IShellBrowserImpl::OnColumnClicked\n");

	return E_NOTIMPL;
}
STDMETHODIMP IShellBrowserImpl::GetCurrentFilter(__RPC__out_ecount_full_string(cchFileSpec) LPWSTR pszFileSpec, int cchFileSpec)
{

	OutputDebugString(L"IShellBrowserImpl::GetCurrentFilter\n");
	return E_NOTIMPL;
}
STDMETHODIMP IShellBrowserImpl::OnPreViewCreated(__RPC__in_opt IShellView *ppshv)
{

	OutputDebugString(L"IShellBrowserImpl::OnPreViewCreated\n");
	return E_NOTIMPL;
}
// IOleCommandTarget methods  
STDMETHODIMP IShellBrowserImpl::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
{
	OutputDebugString(L"IShellBrowserImpl::QueryStatus\n");
	return E_NOTIMPL;
}
STDMETHODIMP IShellBrowserImpl::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
{
	OutputDebugString(L"IShellBrowserImpl::Exec\n");
	//OLECMDID_OPEN
	return E_NOTIMPL;
}